SVGObject

Part of wslib

see also: SVG, SVGFile

The SVGObject is an abstract superclass for the following classes:

SVGGroup

SVGEllipse

SVGRect

SVGLine

SVGCircle

SVGPolyLine

SVGPolygon

SVGPath

SVGText

these are all possible objects for use in a SVGFile

note: in a recent change the abstract SVGGraphicObject class was added, which is the actual superclass of all SVGObjects except SVGText and SVGGroup.

instance variables

name

All objects in a SVG formatted file can have a name as identifier.

transform

can hold a SVGTransform object, containing data about transformations like rotate, scale, translate etc.

instance methods

opacity

for all objects except SVGGroup

Changes the opacity of the colors and writes / reads the opacity element from SVG files.

Opacity is not an instance variable, but can be used as if it were one.

plot

creates a SCWindow (or a JSCWindow if GUI.scheme.id == 'swing' ) and plots the object in it.

draw

to be used inside a drawHook or drawFunc; draws the object.

asPenFunction

returns a function for drawing

asGUICode ( penClass )

returns GUI.pen style code as a compile string. penClass can be a Class or a String ( default "GUI.pen" ).

Running .interpret on the result should draw the object correctly

asRect

returns a Rect derrived from the outer bounds the object

accessing / testing

allObjects

returns the object itself, or it's contents if the object is an SVGGroup as a flat Array (used by SVGFile:allObjects).

elementName

the name of the SVG XML element associated with the object